package routers

import (
	"github.com/gin-gonic/gin"
	"zhanyan/controller"
	"zhanyan/middleware"
	"zhanyan/swag"
)

func InitRouter() *gin.Engine {
	r := gin.New()
	r.Use(gin.Logger())
	r.Use(gin.Recovery())
	r.Use(middleware.Cors())
	r.Use(middleware.JWTAuth())

	r.POST("/login", controller.Login)
	//用于测试
	//r.GET("/hi", func(context *gin.Context) {
	//	context.JSON(200, "你好")
	//})
	UserRouter(r)
	SeatRoute(r)
	ClassroomRouter(r)
	WebsocketRouter(r)
	// 初始化文档
	swag.InitSwagger(r)
	return r
}
